package com.cyy.partner.pojo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

/**
 * @Author: cyy
 * @Date: 2024/4/11
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    private Long id;
    private String username;
    private String nickname;
    private Integer isAdmin; //是否是管理员：0是普通用户，1是管理员
    @JsonIgnore//springmvc把当前对象转换成Json对象时，忽略password
    private String password;
    private String photo;
    private Integer age = 0;
    private Integer sex = 0; // 0是男生，1是女生
    private String address;
    private String phone;
    private String email;
    private String hobby;
    @TableField(fill = FieldFill.INSERT)

//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)

//    @JsonFormat(pattern =  "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    @JsonIgnore //该用户是否已经删除: 0否 1是
    @TableLogic
    private Integer state = 0;
    public User(String username, String password, Integer isAdmin){
        this.username = username;
        this.password = password;
        this.isAdmin = isAdmin;
    }
}
